using System.ComponentModel.DataAnnotations;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 搜索结果项数据传输对象
    /// 用于搜索功能返回的统一搜索结果格式
    /// </summary>
    public class SearchItemDto
    {
        /// <summary>
        /// 项目ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 项目类型 (article, product, page, user, etc.)
        /// </summary>
        public string Type { get; set; } = string.Empty;

        /// <summary>
        /// 项目标题
        /// </summary>
        [Required]
        [StringLength(255)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 项目摘要/描述
        /// </summary>
        [StringLength(1000)]
        public string? Summary { get; set; }

        /// <summary>
        /// 项目URL或路径
        /// </summary>
        public string? Url { get; set; }

        /// <summary>
        /// 缩略图URL
        /// </summary>
        public string? Thumbnail { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 搜索相关性得分
        /// </summary>
        public double Score { get; set; }

        /// <summary>
        /// 高亮显示的内容片段
        /// </summary>
        public List<string>? Highlights { get; set; }

        /// <summary>
        /// 扩展属性
        /// </summary>
        public Dictionary<string, object>? Metadata { get; set; }

        /// <summary>
        /// 分类信息
        /// </summary>
        public string? Category { get; set; }

        /// <summary>
        /// 标签列表
        /// </summary>
        public List<string>? Tags { get; set; }

        /// <summary>
        /// 作者信息
        /// </summary>
        public string? Author { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string? Status { get; set; }

        /// <summary>
        /// 统计信息
        /// </summary>
        public SearchStatsDto? Stats { get; set; }
    }

    /// <summary>
    /// 搜索项统计信息
    /// </summary>
    public class SearchStatsDto
    {
        /// <summary>
        /// 浏览量
        /// </summary>
        public int ViewCount { get; set; }

        /// <summary>
        /// 点赞数
        /// </summary>
        public int LikeCount { get; set; }

        /// <summary>
        /// 评论数
        /// </summary>
        public int CommentCount { get; set; }

        /// <summary>
        /// 收藏数
        /// </summary>
        public int FavoriteCount { get; set; }

        /// <summary>
        /// 下载数
        /// </summary>
        public int DownloadCount { get; set; }
    }
}
